package com.xiaoquan.myspring.SpringIOC.step1;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @Author: 周海权
 * @CreateTime: 2024-08-30
 * @Description: Bean工厂
 * @Version: 1.0
 */
public class BeanFactory {
    //定义一个Map存放Bean的信息
    private Map<String,BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String,BeanDefinition>();
    //通过key找到BeanDefinition
    public Object getBean(String name){
        return beanDefinitionMap.get(name).getBean();
    }
    //注册BeanDefinition
    public void registerBeanDefinition(String name,BeanDefinition beanDefinition){
        beanDefinitionMap.put(name,beanDefinition);
    }
}